package com.poly.objectpoly_;

public class Polyobject {
    public static void main(String[] args) {
    //animal 编译类型是 Animal，运行类型是 Dog
    Animal animal = new Dog();
    //因为运行时，执行到该行时，animal运行类型是Dog,所以cry是Dog的cry
    animal.cry();

    //animal 编译类型是 Animal,运行类型是 Cat
    animal = new Cat();
    animal.cry();
    }
}
